<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="actions" scope="application" class="DataAccess.Actions"/>

<%@page import="java.sql.*"%>

     <%
        String id_stato = request.getParameter("id_stato");
        String Default_Text =  "Seleziona...";
        try {
            
            //Class.forName("com.mysql.jdbc.Driver");
            Class.forName(actions.getDriverString());
            //Connection cn = DriverManager.getConnection ("jdbc:mysql://127.0.0.1/carta?user=root&password=");
            Connection cn = DriverManager.getConnection (actions.getConnectionString());
            
            java.sql.Statement stmt = cn.createStatement();
            String sql="SELECT id_regione, nome_regione from regioni where id_stato = " + id_stato;
            ResultSet rs;
            
           // if (Default_ID != "0") {
           //     rs = stmt.executeQuery(sql + " where " + CampoID + "=" + Default_ID);
           //     if (rs.next()) {
           //         Default_Text = "*" + rs.getString(CampoDescrizione) + "*";
           //     }
           // }
            
            rs = stmt.executeQuery(sql);
            %>
            
               Regione: <SELECT id='id_regione' name='id_regione' onchange="showSlide('province','Province.jsp?id_regione=' + this.options[this.selectedIndex].value)">
            
            
            <option value="0"> Scegli la regione...
            <%
            while (rs.next()) {
            %>
            <option value="<%=rs.getString(1)%>"> <%=rs.getString(2)%> </option>;
            <%
            }   
            stmt.close();
            rs.close();
            cn.close();
        }
            catch (Exception e) {
                //System.out.print(showError(e));
        }
    %>
